// Spectator.cpp : Defines the entry point for the console application.

#include <iostream>
#include <string>

#include "39dll/39dll.h"

int main()
{
	Init();

	std::string t_ip;

	std::cout << "Enter Ip: ";
	std::cin >> t_ip;

	std::cout << "Connecting to " << t_ip << "\n";
	int t_server = tcpconnect((char*) t_ip.c_str(), 14800, 0);

	if(t_server <= 0) return 1;
	else std::cout << "Connection Successful\n";

	while(true)
	{
		if(receivemessage(t_server,0,0))
		{
			std::cout << "Message Received\n";

			switch(readbyte(0))
			{
			case 0:
				std::cout << readstring(0);
			break;
			
			case 1:
				return 0;
			break;
			}
		}
	}

	return 0;
}

